package cn.minsh.lims.eoms.modules.app.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import cn.minsh.lims.eoms.modules.app.entity.RepairOrderRecordEntity;
import cn.minsh.lims.eoms.modules.app.service.RepairOrderRecordService;
import cn.minsh.lims.eoms.common.utils.PageUtils;
import cn.minsh.lims.eoms.common.utils.R;



/**
 * 保养工单操作记录
 *
 * @author lht
 * @email sunlightcs@gmail.com
 * @date 2021-04-30 00:17:00
 */
@RestController
@RequestMapping("sys/repairOrderRecord")
public class RepairOrderRecordController {
    @Autowired
    private RepairOrderRecordService repairOrderRecordService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("app:repairorderrecord:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = repairOrderRecordService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("app:repairorderrecord:info")
    public R info(@PathVariable("id") Long id){
		RepairOrderRecordEntity repairOrderRecord = repairOrderRecordService.getById(id);

        return R.ok().put("repairOrderRecord", repairOrderRecord);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("app:repairorderrecord:save")
    public R save(@RequestBody RepairOrderRecordEntity repairOrderRecord){
		repairOrderRecordService.save(repairOrderRecord);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("app:repairorderrecord:update")
    public R update(@RequestBody RepairOrderRecordEntity repairOrderRecord){
		repairOrderRecordService.updateById(repairOrderRecord);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("app:repairorderrecord:delete")
    public R delete(@RequestBody Long[] ids){
		repairOrderRecordService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
